package service.Impl;

import dao.EmployeeRepository;
import dao.Impl.EmployeeRepositoryImpl;
import entity.Employee;
import service.EmployeeService;

import java.util.ArrayList;

public class EmployeeServiceImpl implements EmployeeService {

    /**
     * 获取员工信息表
     */
    @Override
    public ArrayList<Employee> getEmployeeList(){
        EmployeeRepository employeeRepository = new EmployeeRepositoryImpl();
        return employeeRepository.getEmployeeList();
    }

    /**
     * 添加员工信息
     */
    @Override
    public boolean addEmployee(Employee employee) {
        EmployeeRepository employeeRepository = new EmployeeRepositoryImpl();
        return employeeRepository.addEmployee(employee);
    }

    /**
     * 根据员工编号返回员工信息
     */
    @Override
    public Employee findById(Integer employeeId) {
        EmployeeRepository employeeRepository = new EmployeeRepositoryImpl();
        return employeeRepository.findById(employeeId);
    }
    /**
     * 修改员工信息
     */
    @Override
    public boolean updateEmployee(Employee employee) {
        EmployeeRepository employeeRepository = new EmployeeRepositoryImpl();
        return employeeRepository.updateEmployee(employee);
    }

    /**
     * 根据员工编号删除员工信息
     */
    @Override
    public boolean deleteEmployee(Integer employeeId) {
        EmployeeRepository employeeRepository = new EmployeeRepositoryImpl();
        return employeeRepository.deleteEmployee(employeeId);
    }

}
